package com.jeesite.modules.pt.service;

import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.pt.entity.PtSetting;
import com.jeesite.modules.pt.dao.PtSettingDao;

/**
 * 平台参数Service
 * @author 李寒冰
 * @version 2024-12-10
 */
@Service
public class PtSettingService extends CrudService<PtSettingDao, PtSetting> {
	
	/**
	 * 获取单条数据
	 * @param ptSetting
	 * @return
	 */
	@Override
	public PtSetting get(PtSetting ptSetting) {
		return super.get(ptSetting);
	}
	
	/**
	 * 查询分页数据
	 * @param ptSetting 查询条件
	 * @param ptSetting page 分页对象
	 * @return
	 */
	@Override
	public Page<PtSetting> findPage(PtSetting ptSetting) {
		return super.findPage(ptSetting);
	}

	public String getValueByKey(String key) {
		PtSetting ptSetting = new PtSetting();
		ptSetting.setParamKey(key);
		List<PtSetting> list = findList(ptSetting);
		if(list.size()>0){
			return list.get(0).getParamValue();
		}else{
			return null;
		}

	}
	
	/**
	 * 查询列表数据
	 * @param ptSetting
	 * @return
	 */
	@Override
	public List<PtSetting> findList(PtSetting ptSetting) {
		return super.findList(ptSetting);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param ptSetting
	 */
	@Override
	@Transactional
	public void save(PtSetting ptSetting) {
		super.save(ptSetting);
	}
	
	/**
	 * 更新状态
	 * @param ptSetting
	 */
	@Override
	@Transactional
	public void updateStatus(PtSetting ptSetting) {
		super.updateStatus(ptSetting);
	}
	
	/**
	 * 删除数据
	 * @param ptSetting
	 */
	@Override
	@Transactional
	public void delete(PtSetting ptSetting) {
		super.delete(ptSetting);
	}
	
}